package one.stand.controller;

import one.stand.entity.websocket.CommodityInfoEntity;
import one.stand.model.ResultModel;
import one.stand.request.GoodSpecRequest;
import one.stand.request.GoodsAssembleRequest;
import one.stand.request.GoodsRequest;
import one.stand.request.GoodstypeRequest;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 产品信息管理
 * @author Administrator
 */
@RestController
@RequestMapping("/goods")
public class GoodsController extends BaseController {

    /**
     * 根据公司ID查询产品分类（包含商品信息）
     */
    @PostMapping("/selectGoodsTypeInfo")
    public ResultModel selectGoodsTypeInfo(@RequestBody GoodstypeRequest request){
        return goodsService.selectGoodsTypeInfo(request);
    }

    /**
     * 根据公司ID查询产品分类（包含商品信息）PC端
     */
    @PostMapping("/selectGoodsTypeInfoPC")
    public ResultModel<Map<String, Object>> selectGoodsTypeInfoPC(@RequestBody GoodstypeRequest request){
        return goodsService.selectGoodsTypeInfoPC(request);
    }

    /**
     * 查询简单商品分类
     */
    @PostMapping("/getGoodsTypeInfo")
    public ResultModel getGoodsTypeInfo(@RequestBody GoodstypeRequest request){
        return goodsService.getGoodsTypeInfo(request);
    }

    /**
     * 添加/修改商品分类
     */
    @PostMapping("/addGoodsType")
    public ResultModel addGoodsType(@RequestBody GoodstypeRequest request){
        return goodsService.addGoodsType(request);
    }

    /**
     * 删除商品分类
     */
    @PostMapping("/delGoodsType")
    public ResultModel delGoodsType(@RequestBody GoodstypeRequest request){
        return goodsService.delGoodsType(request);
    }

    /**
     * 上移/下移商品分类
     */
    @PostMapping("/moveGoodsType")
    public ResultModel moveGoodsType(@RequestBody GoodstypeRequest request){
        return goodsService.moveGoodsType(request);
    }

    /**
     * 查询商品信息
     */
    @PostMapping("/getGoodsInfo")
    public ResultModel getGoodsInfo(@RequestBody GoodsRequest request){
        return goodsService.getGoodsInfo(request);
    }

    /**
     * 查询商品信息 PC端
     */
    @PostMapping("/getGoodsInfoPC")
    public ResultModel<Map<String, Object>> getGoodsInfoPC(@RequestBody GoodsRequest request){
        return goodsService.getGoodsInfoPC(request);
    }

    /**
     * 移动商品信息 PC端
     */
    @PostMapping("/moveGoodsInfo")
    public ResultModel<Boolean> moveGoodsInfo(@RequestBody GoodsRequest request){
        return goodsService.moveGoodsInfo(request);
    }

    /**
     * 添加/修改商品信息(旧)
     */
    @PostMapping("/addGoodsInfo")
    public ResultModel addGoodsInfo(@RequestBody GoodsRequest request){
        return goodsService.addGoodsInfo(request);
    }

    /**
     * 添加/修改商品信息（新-3.2版本迭代）
     */
    @PostMapping("/addGoodsInfoList")
    public ResultModel addGoodsInfoList(@RequestBody GoodsRequest request){
        return goodsService.addGoodsInfoList(request);
    }

    /**
     * 添加/修改商品规格信息
     */
    @PostMapping("/addGoodSpecInfo")
    public ResultModel addGoodSpecInfo(@RequestBody GoodSpecRequest request){
        return goodsService.addGoodSpecInfo(request);
    }

    /**
     * 转移产品
     */
    @PostMapping("/transferGoods")
    public ResultModel transferGoods(@RequestBody GoodsRequest request){
        return goodsService.transferGoods(request);
    }

    /**
     * 删除商品信息
     */
    @PostMapping("/delGoodsInfo")
    public ResultModel delGoodsInfo(@RequestBody GoodsRequest request){
        return goodsService.delGoodsInfo(request);
    }

    /**
     * 删除商品规格信息
     */
    @PostMapping("/delGoodSpecInfo")
    public ResultModel delGoodSpecInfo(@RequestBody GoodSpecRequest request){
        return goodsService.delGoodSpecInfo(request);
    }

    /**
     * 聊天获取商品信息
     * @param specId
     * @return
     */
    @PostMapping("/getSendMessage")
    public ResultModel<CommodityInfoEntity> getSendMessage(@RequestBody Long specId){
        return goodsService.getSendMessage(specId);
    }
}
